<template>
  <div class="m-header">
    <div class="m-header-left">
      <slot name="overwrite-left">
        <transition :name="transition">
          <a class="m-header-back"></a>
        </transition>
        <transition :name="transition">
          <div class="left-arrow"></div>
        </transition>
      </slot>
      <slot name="left"></slot>
    </div>
    <h1 class="m-header-title" @click="$emit('on-click-title')">
      <slot>
        <transition :name="transition">
          <span v-show="title">{{ title }}</span>
        </transition>
      </slot>
    </h1>
    <div class="m-header-right"></div>
  </div>
</template>

<script>
export default {
  name: 'm-header',
  props: {
    fixed: Boolean,
    title: String,
    transition: String
  },
  computed: {

  },
  methods: {

  }
}
</script>

<style lang="scss">
@import '../../styles/var.scss';

.m-header {
  position: relative;
  padding: 3px 0;
  box-sizing: border-box;
  background-color: $primary-color;

  .m-header-title, h1 {
    margin: 0 88px;
    line-height: 40px;
    text-align: center;
    height: 40px;
    width: auto;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #fff;
    font-size: 18px;
    font-weight: 400;
  }

  .m-header-title > span {
    display: inline-block;
  }

  &-left, &-right {
    position: absolute;
    top: 14px;
  }
}
</style>
